package com.lvhr.rpc.fault.retry;


import com.lvhr.rpc.config.RetryStrategyConfig;
import com.lvhr.rpc.config.RpcConfig;
import com.lvhr.rpc.model.RpcResponse;

import java.util.concurrent.Callable;

/**
 * 重试策略
 *
 */
public interface RetryStrategy {

    /**
     * 重试
     *
     * @param callable
     * @return
     * @throws Exception
     */
    RpcResponse doRetry(Callable<RpcResponse> callable) throws Exception;

    /**
     * 初始化
     *
     * @param config
     */
    void init(RpcConfig config);
}
